package com.ss.android.article.browser.main;

import android.annotation.TargetApi;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;

public class ScrollTopLayout extends FrameLayout {
    private View.OnTouchListener a;
    private View b;
    private View c;
    private View d;
    private View e;

    public ScrollTopLayout(@NonNull Context arg1) {
        super(arg1);
    }

    public ScrollTopLayout(@NonNull Context arg1, @Nullable AttributeSet arg2) {
        super(arg1, arg2);
    }

    public ScrollTopLayout(@NonNull Context arg1, @Nullable AttributeSet arg2, int arg3) {
        super(arg1, arg2, arg3);
    }

    @TargetApi(value=21) public ScrollTopLayout(@NonNull Context arg1, @Nullable AttributeSet arg2, int arg3, int arg4) {
        super(arg1, arg2, arg3, arg4);
    }

    public boolean dispatchTouchEvent(MotionEvent arg2) {
        boolean v0;
        if(this.a != null) {
            super.dispatchTouchEvent(arg2);
            v0 = this.a.onTouch(((View)this), arg2);
        }
        else {
            v0 = super.dispatchTouchEvent(arg2);
        }

        return v0;
    }

    protected void onFinishInflate() {
        super.onFinishInflate();
        this.b = this.findViewById(com.ss.android.article.browser.R.id.home_page_header_layout);
        this.c = this.findViewById(com.ss.android.article.browser.R.id.website_navi_grid);
        this.d = this.findViewById(com.ss.android.article.browser.R.id.yy);
        this.e = this.findViewById(com.ss.android.article.browser.R.id.yz);
    }

    protected void onLayout(boolean arg3, int arg4, int arg5, int arg6, int arg7) {
        this.b.layout(arg4, arg5, arg6, arg7 - this.c.getMeasuredHeight());
        this.c.layout(arg4, arg7 - this.c.getMeasuredHeight(), arg6, arg7);
        this.d.layout(arg4, arg5, arg6, arg7 - this.c.getMeasuredHeight());
        this.e.layout(arg4, arg5, arg6, arg7 - this.c.getMeasuredHeight());
    }

    protected void onMeasure(int arg4, int arg5) {
        this.c.measure(arg4, 0);
        this.b.measure(arg4, 0);
        this.setMeasuredDimension(this.b.getMeasuredWidth(), this.b.getMeasuredHeight() + this.c.getMeasuredHeight());
    }

    public void setDispatchTouchListener(View.OnTouchListener arg1) {
        this.a = arg1;
    }
}

